<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>游记发布</title>
<{include file="header.html"}>
<style type="text/css">
  #first_a{
  width:241px;
  border:1px solid #CCC;
}
#first_a tr:hover{
  background:#969;
}
#first_a table{
width:100%;
}
#first_a{
  display:none;
}
</style>
    <div id="cont">
        <div id="tban">
            <div id="tban_le">
                <div id="tban_le_01">
                    <img src="../../tpl/images/nlw_dqbg2.jpg" width="10" height="103" />
                </div>
                <div id="tban_le_02">
                    <h1>
                        厦门周边旅游景点
                    </h1>
                    <div id="tban_le_txt">
                        厦门周边旅游景点大全，推荐当季最佳最受欢迎的旅游景点，还有适合周末休闲的好去处。
                    </div>
                </div>
                <div id="tban_le_03">
                    <img src="../../tpl/images/nlw_dqbg4.jpg" width="10" height="103" />
                </div>
            </div>
            <div id="tban_ri">
                <div id="tban_le_01">
                    <img src="../../tpl/images/nlw_dqbg2.jpg" width="10" height="103" />
                </div>
                <div id="tban_le_02">
                    <h1>
                        推荐分类
                    </h1>
                    <div id="tban_le_txt" class="tgray1">
                        厦门周边一日游 厦门周边农家乐 厦门有什么好玩的地方
                    </div>
                </div>
                <div id="tban_le_03">
                    <img src="../../tpl/images/nlw_dqbg4.jpg" width="10" height="103" />
                </div>
            </div>
        </div>
    </div>
    <div id="cont">
        <div id="d_tit06">
            发布照片</div>
        <div id="d_bk_t">
            <div id="d_bk_t01">
                <div class="c1">
                </div>
            </div>
            <div id="d_bk_t02">
                <div class="c1">
                </div>
            </div>
        </div>
            <div id="userinfo_bk">
              <div id="userinfo_bk2">

                <style type="text/css">
                .uploadify-button {
                  background-color: transparent;
                  border: none;
                  padding: 0;
                }
                .uploadify:hover .uploadify-button {
                  background-color: transparent;
                }
                </style>
                  
                <table id="picarray" width="420" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#d1d1d1">
                </table>

                <div id="upload">
                  <input id="file_upload" name="file_upload" type="file" multiple>
                  <input type="hidden" class="input-xlarge" name="type" id="type" value="<{$type}>">
                  <input type="hidden" class="input-xlarge" name="pid" id="pid" value="<{$pid}>">
                  <input type="hidden" class="input-xlarge" name="picurl" id="picurl" value="<{$picurl}>">
                </div>
                
                <div id="picsubmit" style="display:none">
                <a id="ex3button" href="javascript:;"><img src="../../../tpl/images/nlw_bt3.gif" width="148" height="36" /></a>
                </div>
                
                <{if $type != "scenery"}>
                <table width="420" style="margin-top:10px;" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#d1d1d1">
                <{foreach item=picturesout from=$pictures key=enname}>
                    <td colspan="2" bgcolor="#FFFFFF" class="tab_right"><a target="_blank" title="<{$picturesout.title}>" href="<{spUrl}>uploadify/uploads/<{$picturesout.picurl}>"><img width="400" height="300" src="<{spUrl}>uploadify/uploads/<{$picturesout.picurl}>" /></a>
                    <{if $type == "album" }>
                    <a href="javascript:tops(<{$picturesout.id}>);">[设置封面]</a>
                    <{/if}>
                    <input type="hidden" class="input-xlarge" name="<{$picturesout.id}>" id="<{$picturesout.id}>" value="<{spUrl}>uploadify/uploads/<{$picturesout.picurl}>">
                    </td>
                <{/foreach}>
                </table>
                <{/if}>

                </div>
      </div>
   <div id="d_bk_b">
            <div id="d_bk_b01">
                <div class="c1">
                </div>
            </div>
            <div id="d_bk_b02">
                <div class="c1">
                </div>
            </div>
        </div>
    </div>
<script type="text/javascript" src="<{$domain}>/tpl/js/jquery-1.7.0.min.js"></script> 
<script src="<{$domain}>/uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="<{$domain}>/uploadify/uploadify.css">
<script type="text/javascript">
    $(function() {
    var n=0;
    //=======================================
    $('#file_upload').uploadify({
       'formData'     : {
                'timestamp' : '<{$timestamp}>',
                'token'     : '<{$token}>'
        },
        'buttonImage' : '<{$domain}>/uploadify/browse-btn.png',
        'swf'      : '<{$domain}>/uploadify/uploadify.swf',
        'uploader' : '<{$domain}>/uploadify/uploadify.php',
        'multi':true, 
        'onUploadSuccess':function(file, data, response){

           $('#picsubmit').show();
           //$('#upload').css("display","none");
           $("#picarray").after("<tr><td colspan='2' bgcolor='#FFFFFF' class='tab_right'><input type='text' name='picname"+n+"' class='tab_txt1' size='100' id='picname"+n+"' value='<{$scenery_show.title}>"+n+"'><div style='margin-top:10px'><img width=400 hight=300 src='<{$domain}>/uploadify/uploads/"+data+"' /></div><input type='hidden' name='picurl"+n+"' id='picurl"+n+"' value='"+data+"'><br />");
          n++;
        }
    });
 //=======================================
    $("#ex3button").click(function(){ // "提交"按钮被点击
       // 构造发送的数据，请注意如果获取表单各项的值
        var newId;
      var i = 0;
      picurls = "";
      picnames = "";
      // 封面自动设置
      var tjpicurl = $('#picurl').val();
      if(tjpicurl == "default")
      { tops(id); }
      // 封面自动设置
      while (i<=n-1)
      {
          var id = 0;
          var formdata = {
             'title' : $('#picname'+i).val(),
             'types' : $('#type').val(),
             'linkid' : $('#pid').val(),
             'picurl' : $('#picurl'+i).val()
           };
              // 用$.post发送数据
           $.post('<{spUrl c=albuminfoform a=uppicdata}>', formdata, function(result){
                  //$('#resulttable').append(result);
               newId =result.match(/^\d.*$/);
               feedback(result,id,newId);
            });
        i=i+1
      }
    });

    });
   //$uploadify = jQuery.noConflict();
   function tops(id){

      var picurl = "";
      if(id != null)
      { picurl = $('#'+id).val(); }
      else
      { picurl = "<{spUrl}>uploadify/uploads/" + $('#picurl0').val();}
       
      var formdata = {
       'pid' : $('#pid').val(),
       'picurl' : picurl
      };
      $.post('<{spUrl c=albuminfoform a=topsdata}>', formdata, function(result){
            //$('#resulttable').append(result);
      if(id != null){
       if( result != 0)
        { alert("封面设置成功");}
       else
        { alert("封面设置失败");}
       }
      });
   }
</script>
<script>
    function feedback(result,id,newId){
        if(newId == null)
        {
            $('.badge').removeClass('badge badge-info').text('');
            var response = eval("("+result+")");
            for(var i in response){
                $('#' + i).next().addClass('badge badge-info');
                $('#' + i).next().text(response[i].toString());
//      console.log(response[i].toString());
            }
            //$('.badge').text('sdfsd');
        }
        else
        {
            alert('添加成功!!'+newId);window.location.href="<{spUrl}>photo/"+newId+".html";
        }
    }
</script> <!--ajax 掉数据需要处理-->
<{include file="footer.html"}>